package day04;

import java.util.Scanner;
public class SwitchDemo03 {

    static double balance;
    public static void main(String[] args) {
        // ATM机功能。
        Scanner sc = new Scanner(System.in);// 创建键盘扫描
        boolean loop = true;
        do {

            System.out.println("请选择功能：1存款 2取款 3查询余额 4 退卡");
            int num =sc.nextInt();// 接收输入的整数
            //String num =sc.nextLine();
            switch(num){
                case 1:
                    save();
                    break;
                case 2:
                    System.out.println("取款功能");
                    break;
                case 3:
                    System.out.println("查询余额....");
                    break;
                case 4:
                    System.out.println("退卡");
                    loop = false;
                    break;
                default:
                    System.out.println("输入错误没有该功能！！！");

            }
        }while (loop);


    }

    private static void save() {
        System.out.println("存款功能");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入存款金额");
        double num = sc.nextDouble();
        balance +=num;

    }
}
